package com.bawei.caohao0802.viewmodel

import androidx.lifecycle.MutableLiveData
import androidx.lifecycle.ViewModel
import com.bawei.caohao0802.model.bean.KaiBean
import com.bawei.caohao0802.model.bean.ZbBean
import com.bawei.caohao0802.model.util.HttpUtils
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.schedulers.Schedulers
import okhttp3.MultipartBody
import retrofit2.http.Header
import retrofit2.http.Part
import retrofit2.http.Query
import java.io.File

/**
 * 作者: 曹浩
 * 时间: 2024/8/2
 * 功能描述:
 */
class TvViewModel :ViewModel(){
    var zbdata=MutableLiveData<ZbBean>()
    fun getzb(
         userId: String,
         sessionId: String,
         liveId: Int,
    ){
        HttpUtils.httpUtils.server.getzb(userId, sessionId, liveId)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe {
                zbdata.value=it
            }
    }
    var kaidata=MutableLiveData<KaiBean>()
    fun getkai(
        userId: String,
        sessionId: String,
        liveId: Int,
        liveTitle: String,
        longitude: String,
        latitude: String,
        multipartBody: MultipartBody.Part,
    ){
        HttpUtils.httpUtils.server.getkai(userId, sessionId, liveId, liveTitle, longitude, latitude, multipartBody)
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe {
                kaidata.value=it
            }
    }

}